Left Termination of the query pattern sameleaves_in_2(g, g) w.r.t. the given Prolog program could successfully be proven:



Prolog
  ↳ PrologToPiTRSProof

Clauses:

sameleaves(leaf(L), leaf(L)).
sameleaves(tree(T1, T2), tree(S1, S2)) :- ','(getleave(T1, T2, L, T), ','(getleave(S1, S2, L, S), sameleaves(T, S))).
getleave(leaf(A), C, A, C).
getleave(tree(A, B), C, L, O) :- getleave(A, tree(B, C), L, O).

Queries:

sameleaves(g,g).

We use the technique of [30]. With regard to the inferred argument filtering the predicates were used in the following modes:
sameleaves_in: (b,b)
getleave_in: (b,b,f,f) (b,b,b,f)
Transforming Prolog into the following Term Rewriting System:
Pi-finite rewrite system:
The TRS R consists of the following rules:

sameleaves_in_gg(leaf(L), leaf(L)) → sameleaves_out_gg(leaf(L), leaf(L))
sameleaves_in_gg(tree(T1, T2), tree(S1, S2)) → U1_gg(T1, T2, S1, S2, getleave_in_ggaa(T1, T2, L, T))
getleave_in_ggaa(leaf(A), C, A, C) → getleave_out_ggaa(leaf(A), C, A, C)
getleave_in_ggaa(tree(A, B), C, L, O) → U4_ggaa(A, B, C, L, O, getleave_in_ggaa(A, tree(B, C), L, O))
U4_ggaa(A, B, C, L, O, getleave_out_ggaa(A, tree(B, C), L, O)) → getleave_out_ggaa(tree(A, B), C, L, O)
U1_gg(T1, T2, S1, S2, getleave_out_ggaa(T1, T2, L, T)) → U2_gg(T1, T2, S1, S2, T, getleave_in_ggga(S1, S2, L, S))
getleave_in_ggga(leaf(A), C, A, C) → getleave_out_ggga(leaf(A), C, A, C)
getleave_in_ggga(tree(A, B), C, L, O) → U4_ggga(A, B, C, L, O, getleave_in_ggga(A, tree(B, C), L, O))
U4_ggga(A, B, C, L, O, getleave_out_ggga(A, tree(B, C), L, O)) → getleave_out_ggga(tree(A, B), C, L, O)
U2_gg(T1, T2, S1, S2, T, getleave_out_ggga(S1, S2, L, S)) → U3_gg(T1, T2, S1, S2, sameleaves_in_gg(T, S))
U3_gg(T1, T2, S1, S2, sameleaves_out_gg(T, S)) → sameleaves_out_gg(tree(T1, T2), tree(S1, S2))

The argument filtering Pi contains the following mapping:
sameleaves_in_gg(x1, x2)  =  sameleaves_in_gg(x1, x2)
leaf(x1)  =  leaf(x1)
sameleaves_out_gg(x1, x2)  =  sameleaves_out_gg
tree(x1, x2)  =  tree(x1, x2)
U1_gg(x1, x2, x3, x4, x5)  =  U1_gg(x3, x4, x5)
getleave_in_ggaa(x1, x2, x3, x4)  =  getleave_in_ggaa(x1, x2)
getleave_out_ggaa(x1, x2, x3, x4)  =  getleave_out_ggaa(x3, x4)
U4_ggaa(x1, x2, x3, x4, x5, x6)  =  U4_ggaa(x6)
U2_gg(x1, x2, x3, x4, x5, x6)  =  U2_gg(x5, x6)
getleave_in_ggga(x1, x2, x3, x4)  =  getleave_in_ggga(x1, x2, x3)
getleave_out_ggga(x1, x2, x3, x4)  =  getleave_out_ggga(x4)
U4_ggga(x1, x2, x3, x4, x5, x6)  =  U4_ggga(x6)
U3_gg(x1, x2, x3, x4, x5)  =  U3_gg(x5)

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog



↳ Prolog
  ↳ PrologToPiTRSProof
PiTRS
      ↳ DependencyPairsProof

Pi-finite rewrite system:
The TRS R consists of the following rules:

sameleaves_in_gg(leaf(L), leaf(L)) → sameleaves_out_gg(leaf(L), leaf(L))
sameleaves_in_gg(tree(T1, T2), tree(S1, S2)) → U1_gg(T1, T2, S1, S2, getleave_in_ggaa(T1, T2, L, T))
getleave_in_ggaa(leaf(A), C, A, C) → getleave_out_ggaa(leaf(A), C, A, C)
getleave_in_ggaa(tree(A, B), C, L, O) → U4_ggaa(A, B, C, L, O, getleave_in_ggaa(A, tree(B, C), L, O))
U4_ggaa(A, B, C, L, O, getleave_out_ggaa(A, tree(B, C), L, O)) → getleave_out_ggaa(tree(A, B), C, L, O)
U1_gg(T1, T2, S1, S2, getleave_out_ggaa(T1, T2, L, T)) → U2_gg(T1, T2, S1, S2, T, getleave_in_ggga(S1, S2, L, S))
getleave_in_ggga(leaf(A), C, A, C) → getleave_out_ggga(leaf(A), C, A, C)
getleave_in_ggga(tree(A, B), C, L, O) → U4_ggga(A, B, C, L, O, getleave_in_ggga(A, tree(B, C), L, O))
U4_ggga(A, B, C, L, O, getleave_out_ggga(A, tree(B, C), L, O)) → getleave_out_ggga(tree(A, B), C, L, O)
U2_gg(T1, T2, S1, S2, T, getleave_out_ggga(S1, S2, L, S)) → U3_gg(T1, T2, S1, S2, sameleaves_in_gg(T, S))
U3_gg(T1, T2, S1, S2, sameleaves_out_gg(T, S)) → sameleaves_out_gg(tree(T1, T2), tree(S1, S2))

The argument filtering Pi contains the following mapping:
sameleaves_in_gg(x1, x2)  =  sameleaves_in_gg(x1, x2)
leaf(x1)  =  leaf(x1)
sameleaves_out_gg(x1, x2)  =  sameleaves_out_gg
tree(x1, x2)  =  tree(x1, x2)
U1_gg(x1, x2, x3, x4, x5)  =  U1_gg(x3, x4, x5)
getleave_in_ggaa(x1, x2, x3, x4)  =  getleave_in_ggaa(x1, x2)
getleave_out_ggaa(x1, x2, x3, x4)  =  getleave_out_ggaa(x3, x4)
U4_ggaa(x1, x2, x3, x4, x5, x6)  =  U4_ggaa(x6)
U2_gg(x1, x2, x3, x4, x5, x6)  =  U2_gg(x5, x6)
getleave_in_ggga(x1, x2, x3, x4)  =  getleave_in_ggga(x1, x2, x3)
getleave_out_ggga(x1, x2, x3, x4)  =  getleave_out_ggga(x4)
U4_ggga(x1, x2, x3, x4, x5, x6)  =  U4_ggga(x6)
U3_gg(x1, x2, x3, x4, x5)  =  U3_gg(x5)


Using Dependency Pairs [1,30] we result in the following initial DP problem:
Pi DP problem:
The TRS P consists of the following rules:

SAMELEAVES_IN_GG(tree(T1, T2), tree(S1, S2)) → U1_GG(T1, T2, S1, S2, getleave_in_ggaa(T1, T2, L, T))
SAMELEAVES_IN_GG(tree(T1, T2), tree(S1, S2)) → GETLEAVE_IN_GGAA(T1, T2, L, T)
GETLEAVE_IN_GGAA(tree(A, B), C, L, O) → U4_GGAA(A, B, C, L, O, getleave_in_ggaa(A, tree(B, C), L, O))
GETLEAVE_IN_GGAA(tree(A, B), C, L, O) → GETLEAVE_IN_GGAA(A, tree(B, C), L, O)
U1_GG(T1, T2, S1, S2, getleave_out_ggaa(T1, T2, L, T)) → U2_GG(T1, T2, S1, S2, T, getleave_in_ggga(S1, S2, L, S))
U1_GG(T1, T2, S1, S2, getleave_out_ggaa(T1, T2, L, T)) → GETLEAVE_IN_GGGA(S1, S2, L, S)
GETLEAVE_IN_GGGA(tree(A, B), C, L, O) → U4_GGGA(A, B, C, L, O, getleave_in_ggga(A, tree(B, C), L, O))
GETLEAVE_IN_GGGA(tree(A, B), C, L, O) → GETLEAVE_IN_GGGA(A, tree(B, C), L, O)
U2_GG(T1, T2, S1, S2, T, getleave_out_ggga(S1, S2, L, S)) → U3_GG(T1, T2, S1, S2, sameleaves_in_gg(T, S))
U2_GG(T1, T2, S1, S2, T, getleave_out_ggga(S1, S2, L, S)) → SAMELEAVES_IN_GG(T, S)

The TRS R consists of the following rules:

sameleaves_in_gg(leaf(L), leaf(L)) → sameleaves_out_gg(leaf(L), leaf(L))
sameleaves_in_gg(tree(T1, T2), tree(S1, S2)) → U1_gg(T1, T2, S1, S2, getleave_in_ggaa(T1, T2, L, T))
getleave_in_ggaa(leaf(A), C, A, C) → getleave_out_ggaa(leaf(A), C, A, C)
getleave_in_ggaa(tree(A, B), C, L, O) → U4_ggaa(A, B, C, L, O, getleave_in_ggaa(A, tree(B, C), L, O))
U4_ggaa(A, B, C, L, O, getleave_out_ggaa(A, tree(B, C), L, O)) → getleave_out_ggaa(tree(A, B), C, L, O)
U1_gg(T1, T2, S1, S2, getleave_out_ggaa(T1, T2, L, T)) → U2_gg(T1, T2, S1, S2, T, getleave_in_ggga(S1, S2, L, S))
getleave_in_ggga(leaf(A), C, A, C) → getleave_out_ggga(leaf(A), C, A, C)
getleave_in_ggga(tree(A, B), C, L, O) → U4_ggga(A, B, C, L, O, getleave_in_ggga(A, tree(B, C), L, O))
U4_ggga(A, B, C, L, O, getleave_out_ggga(A, tree(B, C), L, O)) → getleave_out_ggga(tree(A, B), C, L, O)
U2_gg(T1, T2, S1, S2, T, getleave_out_ggga(S1, S2, L, S)) → U3_gg(T1, T2, S1, S2, sameleaves_in_gg(T, S))
U3_gg(T1, T2, S1, S2, sameleaves_out_gg(T, S)) → sameleaves_out_gg(tree(T1, T2), tree(S1, S2))

The argument filtering Pi contains the following mapping:
sameleaves_in_gg(x1, x2)  =  sameleaves_in_gg(x1, x2)
leaf(x1)  =  leaf(x1)
sameleaves_out_gg(x1, x2)  =  sameleaves_out_gg
tree(x1, x2)  =  tree(x1, x2)
U1_gg(x1, x2, x3, x4, x5)  =  U1_gg(x3, x4, x5)
getleave_in_ggaa(x1, x2, x3, x4)  =  getleave_in_ggaa(x1, x2)
getleave_out_ggaa(x1, x2, x3, x4)  =  getleave_out_ggaa(x3, x4)
U4_ggaa(x1, x2, x3, x4, x5, x6)  =  U4_ggaa(x6)
U2_gg(x1, x2, x3, x4, x5, x6)  =  U2_gg(x5, x6)
getleave_in_ggga(x1, x2, x3, x4)  =  getleave_in_ggga(x1, x2, x3)
getleave_out_ggga(x1, x2, x3, x4)  =  getleave_out_ggga(x4)
U4_ggga(x1, x2, x3, x4, x5, x6)  =  U4_ggga(x6)
U3_gg(x1, x2, x3, x4, x5)  =  U3_gg(x5)
SAMELEAVES_IN_GG(x1, x2)  =  SAMELEAVES_IN_GG(x1, x2)
GETLEAVE_IN_GGAA(x1, x2, x3, x4)  =  GETLEAVE_IN_GGAA(x1, x2)
U1_GG(x1, x2, x3, x4, x5)  =  U1_GG(x3, x4, x5)
U4_GGAA(x1, x2, x3, x4, x5, x6)  =  U4_GGAA(x6)
GETLEAVE_IN_GGGA(x1, x2, x3, x4)  =  GETLEAVE_IN_GGGA(x1, x2, x3)
U2_GG(x1, x2, x3, x4, x5, x6)  =  U2_GG(x5, x6)
U4_GGGA(x1, x2, x3, x4, x5, x6)  =  U4_GGGA(x6)
U3_GG(x1, x2, x3, x4, x5)  =  U3_GG(x5)

We have to consider all (P,R,Pi)-chains

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
PiDP
          ↳ DependencyGraphProof

Pi DP problem:
The TRS P consists of the following rules:

SAMELEAVES_IN_GG(tree(T1, T2), tree(S1, S2)) → U1_GG(T1, T2, S1, S2, getleave_in_ggaa(T1, T2, L, T))
SAMELEAVES_IN_GG(tree(T1, T2), tree(S1, S2)) → GETLEAVE_IN_GGAA(T1, T2, L, T)
GETLEAVE_IN_GGAA(tree(A, B), C, L, O) → U4_GGAA(A, B, C, L, O, getleave_in_ggaa(A, tree(B, C), L, O))
GETLEAVE_IN_GGAA(tree(A, B), C, L, O) → GETLEAVE_IN_GGAA(A, tree(B, C), L, O)
U1_GG(T1, T2, S1, S2, getleave_out_ggaa(T1, T2, L, T)) → U2_GG(T1, T2, S1, S2, T, getleave_in_ggga(S1, S2, L, S))
U1_GG(T1, T2, S1, S2, getleave_out_ggaa(T1, T2, L, T)) → GETLEAVE_IN_GGGA(S1, S2, L, S)
GETLEAVE_IN_GGGA(tree(A, B), C, L, O) → U4_GGGA(A, B, C, L, O, getleave_in_ggga(A, tree(B, C), L, O))
GETLEAVE_IN_GGGA(tree(A, B), C, L, O) → GETLEAVE_IN_GGGA(A, tree(B, C), L, O)
U2_GG(T1, T2, S1, S2, T, getleave_out_ggga(S1, S2, L, S)) → U3_GG(T1, T2, S1, S2, sameleaves_in_gg(T, S))
U2_GG(T1, T2, S1, S2, T, getleave_out_ggga(S1, S2, L, S)) → SAMELEAVES_IN_GG(T, S)

The TRS R consists of the following rules:

sameleaves_in_gg(leaf(L), leaf(L)) → sameleaves_out_gg(leaf(L), leaf(L))
sameleaves_in_gg(tree(T1, T2), tree(S1, S2)) → U1_gg(T1, T2, S1, S2, getleave_in_ggaa(T1, T2, L, T))
getleave_in_ggaa(leaf(A), C, A, C) → getleave_out_ggaa(leaf(A), C, A, C)
getleave_in_ggaa(tree(A, B), C, L, O) → U4_ggaa(A, B, C, L, O, getleave_in_ggaa(A, tree(B, C), L, O))
U4_ggaa(A, B, C, L, O, getleave_out_ggaa(A, tree(B, C), L, O)) → getleave_out_ggaa(tree(A, B), C, L, O)
U1_gg(T1, T2, S1, S2, getleave_out_ggaa(T1, T2, L, T)) → U2_gg(T1, T2, S1, S2, T, getleave_in_ggga(S1, S2, L, S))
getleave_in_ggga(leaf(A), C, A, C) → getleave_out_ggga(leaf(A), C, A, C)
getleave_in_ggga(tree(A, B), C, L, O) → U4_ggga(A, B, C, L, O, getleave_in_ggga(A, tree(B, C), L, O))
U4_ggga(A, B, C, L, O, getleave_out_ggga(A, tree(B, C), L, O)) → getleave_out_ggga(tree(A, B), C, L, O)
U2_gg(T1, T2, S1, S2, T, getleave_out_ggga(S1, S2, L, S)) → U3_gg(T1, T2, S1, S2, sameleaves_in_gg(T, S))
U3_gg(T1, T2, S1, S2, sameleaves_out_gg(T, S)) → sameleaves_out_gg(tree(T1, T2), tree(S1, S2))

The argument filtering Pi contains the following mapping:
sameleaves_in_gg(x1, x2)  =  sameleaves_in_gg(x1, x2)
leaf(x1)  =  leaf(x1)
sameleaves_out_gg(x1, x2)  =  sameleaves_out_gg
tree(x1, x2)  =  tree(x1, x2)
U1_gg(x1, x2, x3, x4, x5)  =  U1_gg(x3, x4, x5)
getleave_in_ggaa(x1, x2, x3, x4)  =  getleave_in_ggaa(x1, x2)
getleave_out_ggaa(x1, x2, x3, x4)  =  getleave_out_ggaa(x3, x4)
U4_ggaa(x1, x2, x3, x4, x5, x6)  =  U4_ggaa(x6)
U2_gg(x1, x2, x3, x4, x5, x6)  =  U2_gg(x5, x6)
getleave_in_ggga(x1, x2, x3, x4)  =  getleave_in_ggga(x1, x2, x3)
getleave_out_ggga(x1, x2, x3, x4)  =  getleave_out_ggga(x4)
U4_ggga(x1, x2, x3, x4, x5, x6)  =  U4_ggga(x6)
U3_gg(x1, x2, x3, x4, x5)  =  U3_gg(x5)
SAMELEAVES_IN_GG(x1, x2)  =  SAMELEAVES_IN_GG(x1, x2)
GETLEAVE_IN_GGAA(x1, x2, x3, x4)  =  GETLEAVE_IN_GGAA(x1, x2)
U1_GG(x1, x2, x3, x4, x5)  =  U1_GG(x3, x4, x5)
U4_GGAA(x1, x2, x3, x4, x5, x6)  =  U4_GGAA(x6)
GETLEAVE_IN_GGGA(x1, x2, x3, x4)  =  GETLEAVE_IN_GGGA(x1, x2, x3)
U2_GG(x1, x2, x3, x4, x5, x6)  =  U2_GG(x5, x6)
U4_GGGA(x1, x2, x3, x4, x5, x6)  =  U4_GGGA(x6)
U3_GG(x1, x2, x3, x4, x5)  =  U3_GG(x5)

We have to consider all (P,R,Pi)-chains
The approximation of the Dependency Graph [30] contains 3 SCCs with 5 less nodes.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
PiDP
                ↳ UsableRulesProof
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

GETLEAVE_IN_GGGA(tree(A, B), C, L, O) → GETLEAVE_IN_GGGA(A, tree(B, C), L, O)

The TRS R consists of the following rules:

sameleaves_in_gg(leaf(L), leaf(L)) → sameleaves_out_gg(leaf(L), leaf(L))
sameleaves_in_gg(tree(T1, T2), tree(S1, S2)) → U1_gg(T1, T2, S1, S2, getleave_in_ggaa(T1, T2, L, T))
getleave_in_ggaa(leaf(A), C, A, C) → getleave_out_ggaa(leaf(A), C, A, C)
getleave_in_ggaa(tree(A, B), C, L, O) → U4_ggaa(A, B, C, L, O, getleave_in_ggaa(A, tree(B, C), L, O))
U4_ggaa(A, B, C, L, O, getleave_out_ggaa(A, tree(B, C), L, O)) → getleave_out_ggaa(tree(A, B), C, L, O)
U1_gg(T1, T2, S1, S2, getleave_out_ggaa(T1, T2, L, T)) → U2_gg(T1, T2, S1, S2, T, getleave_in_ggga(S1, S2, L, S))
getleave_in_ggga(leaf(A), C, A, C) → getleave_out_ggga(leaf(A), C, A, C)
getleave_in_ggga(tree(A, B), C, L, O) → U4_ggga(A, B, C, L, O, getleave_in_ggga(A, tree(B, C), L, O))
U4_ggga(A, B, C, L, O, getleave_out_ggga(A, tree(B, C), L, O)) → getleave_out_ggga(tree(A, B), C, L, O)
U2_gg(T1, T2, S1, S2, T, getleave_out_ggga(S1, S2, L, S)) → U3_gg(T1, T2, S1, S2, sameleaves_in_gg(T, S))
U3_gg(T1, T2, S1, S2, sameleaves_out_gg(T, S)) → sameleaves_out_gg(tree(T1, T2), tree(S1, S2))

The argument filtering Pi contains the following mapping:
sameleaves_in_gg(x1, x2)  =  sameleaves_in_gg(x1, x2)
leaf(x1)  =  leaf(x1)
sameleaves_out_gg(x1, x2)  =  sameleaves_out_gg
tree(x1, x2)  =  tree(x1, x2)
U1_gg(x1, x2, x3, x4, x5)  =  U1_gg(x3, x4, x5)
getleave_in_ggaa(x1, x2, x3, x4)  =  getleave_in_ggaa(x1, x2)
getleave_out_ggaa(x1, x2, x3, x4)  =  getleave_out_ggaa(x3, x4)
U4_ggaa(x1, x2, x3, x4, x5, x6)  =  U4_ggaa(x6)
U2_gg(x1, x2, x3, x4, x5, x6)  =  U2_gg(x5, x6)
getleave_in_ggga(x1, x2, x3, x4)  =  getleave_in_ggga(x1, x2, x3)
getleave_out_ggga(x1, x2, x3, x4)  =  getleave_out_ggga(x4)
U4_ggga(x1, x2, x3, x4, x5, x6)  =  U4_ggga(x6)
U3_gg(x1, x2, x3, x4, x5)  =  U3_gg(x5)
GETLEAVE_IN_GGGA(x1, x2, x3, x4)  =  GETLEAVE_IN_GGGA(x1, x2, x3)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

GETLEAVE_IN_GGGA(tree(A, B), C, L, O) → GETLEAVE_IN_GGGA(A, tree(B, C), L, O)

R is empty.
The argument filtering Pi contains the following mapping:
tree(x1, x2)  =  tree(x1, x2)
GETLEAVE_IN_GGGA(x1, x2, x3, x4)  =  GETLEAVE_IN_GGGA(x1, x2, x3)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ PiDP
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

GETLEAVE_IN_GGGA(tree(A, B), C, L) → GETLEAVE_IN_GGGA(A, tree(B, C), L)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
PiDP
                ↳ UsableRulesProof
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

GETLEAVE_IN_GGAA(tree(A, B), C, L, O) → GETLEAVE_IN_GGAA(A, tree(B, C), L, O)

The TRS R consists of the following rules:

sameleaves_in_gg(leaf(L), leaf(L)) → sameleaves_out_gg(leaf(L), leaf(L))
sameleaves_in_gg(tree(T1, T2), tree(S1, S2)) → U1_gg(T1, T2, S1, S2, getleave_in_ggaa(T1, T2, L, T))
getleave_in_ggaa(leaf(A), C, A, C) → getleave_out_ggaa(leaf(A), C, A, C)
getleave_in_ggaa(tree(A, B), C, L, O) → U4_ggaa(A, B, C, L, O, getleave_in_ggaa(A, tree(B, C), L, O))
U4_ggaa(A, B, C, L, O, getleave_out_ggaa(A, tree(B, C), L, O)) → getleave_out_ggaa(tree(A, B), C, L, O)
U1_gg(T1, T2, S1, S2, getleave_out_ggaa(T1, T2, L, T)) → U2_gg(T1, T2, S1, S2, T, getleave_in_ggga(S1, S2, L, S))
getleave_in_ggga(leaf(A), C, A, C) → getleave_out_ggga(leaf(A), C, A, C)
getleave_in_ggga(tree(A, B), C, L, O) → U4_ggga(A, B, C, L, O, getleave_in_ggga(A, tree(B, C), L, O))
U4_ggga(A, B, C, L, O, getleave_out_ggga(A, tree(B, C), L, O)) → getleave_out_ggga(tree(A, B), C, L, O)
U2_gg(T1, T2, S1, S2, T, getleave_out_ggga(S1, S2, L, S)) → U3_gg(T1, T2, S1, S2, sameleaves_in_gg(T, S))
U3_gg(T1, T2, S1, S2, sameleaves_out_gg(T, S)) → sameleaves_out_gg(tree(T1, T2), tree(S1, S2))

The argument filtering Pi contains the following mapping:
sameleaves_in_gg(x1, x2)  =  sameleaves_in_gg(x1, x2)
leaf(x1)  =  leaf(x1)
sameleaves_out_gg(x1, x2)  =  sameleaves_out_gg
tree(x1, x2)  =  tree(x1, x2)
U1_gg(x1, x2, x3, x4, x5)  =  U1_gg(x3, x4, x5)
getleave_in_ggaa(x1, x2, x3, x4)  =  getleave_in_ggaa(x1, x2)
getleave_out_ggaa(x1, x2, x3, x4)  =  getleave_out_ggaa(x3, x4)
U4_ggaa(x1, x2, x3, x4, x5, x6)  =  U4_ggaa(x6)
U2_gg(x1, x2, x3, x4, x5, x6)  =  U2_gg(x5, x6)
getleave_in_ggga(x1, x2, x3, x4)  =  getleave_in_ggga(x1, x2, x3)
getleave_out_ggga(x1, x2, x3, x4)  =  getleave_out_ggga(x4)
U4_ggga(x1, x2, x3, x4, x5, x6)  =  U4_ggga(x6)
U3_gg(x1, x2, x3, x4, x5)  =  U3_gg(x5)
GETLEAVE_IN_GGAA(x1, x2, x3, x4)  =  GETLEAVE_IN_GGAA(x1, x2)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

GETLEAVE_IN_GGAA(tree(A, B), C, L, O) → GETLEAVE_IN_GGAA(A, tree(B, C), L, O)

R is empty.
The argument filtering Pi contains the following mapping:
tree(x1, x2)  =  tree(x1, x2)
GETLEAVE_IN_GGAA(x1, x2, x3, x4)  =  GETLEAVE_IN_GGAA(x1, x2)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

GETLEAVE_IN_GGAA(tree(A, B), C) → GETLEAVE_IN_GGAA(A, tree(B, C))

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
PiDP
                ↳ UsableRulesProof

Pi DP problem:
The TRS P consists of the following rules:

U1_GG(T1, T2, S1, S2, getleave_out_ggaa(T1, T2, L, T)) → U2_GG(T1, T2, S1, S2, T, getleave_in_ggga(S1, S2, L, S))
U2_GG(T1, T2, S1, S2, T, getleave_out_ggga(S1, S2, L, S)) → SAMELEAVES_IN_GG(T, S)
SAMELEAVES_IN_GG(tree(T1, T2), tree(S1, S2)) → U1_GG(T1, T2, S1, S2, getleave_in_ggaa(T1, T2, L, T))

The TRS R consists of the following rules:

sameleaves_in_gg(leaf(L), leaf(L)) → sameleaves_out_gg(leaf(L), leaf(L))
sameleaves_in_gg(tree(T1, T2), tree(S1, S2)) → U1_gg(T1, T2, S1, S2, getleave_in_ggaa(T1, T2, L, T))
getleave_in_ggaa(leaf(A), C, A, C) → getleave_out_ggaa(leaf(A), C, A, C)
getleave_in_ggaa(tree(A, B), C, L, O) → U4_ggaa(A, B, C, L, O, getleave_in_ggaa(A, tree(B, C), L, O))
U4_ggaa(A, B, C, L, O, getleave_out_ggaa(A, tree(B, C), L, O)) → getleave_out_ggaa(tree(A, B), C, L, O)
U1_gg(T1, T2, S1, S2, getleave_out_ggaa(T1, T2, L, T)) → U2_gg(T1, T2, S1, S2, T, getleave_in_ggga(S1, S2, L, S))
getleave_in_ggga(leaf(A), C, A, C) → getleave_out_ggga(leaf(A), C, A, C)
getleave_in_ggga(tree(A, B), C, L, O) → U4_ggga(A, B, C, L, O, getleave_in_ggga(A, tree(B, C), L, O))
U4_ggga(A, B, C, L, O, getleave_out_ggga(A, tree(B, C), L, O)) → getleave_out_ggga(tree(A, B), C, L, O)
U2_gg(T1, T2, S1, S2, T, getleave_out_ggga(S1, S2, L, S)) → U3_gg(T1, T2, S1, S2, sameleaves_in_gg(T, S))
U3_gg(T1, T2, S1, S2, sameleaves_out_gg(T, S)) → sameleaves_out_gg(tree(T1, T2), tree(S1, S2))

The argument filtering Pi contains the following mapping:
sameleaves_in_gg(x1, x2)  =  sameleaves_in_gg(x1, x2)
leaf(x1)  =  leaf(x1)
sameleaves_out_gg(x1, x2)  =  sameleaves_out_gg
tree(x1, x2)  =  tree(x1, x2)
U1_gg(x1, x2, x3, x4, x5)  =  U1_gg(x3, x4, x5)
getleave_in_ggaa(x1, x2, x3, x4)  =  getleave_in_ggaa(x1, x2)
getleave_out_ggaa(x1, x2, x3, x4)  =  getleave_out_ggaa(x3, x4)
U4_ggaa(x1, x2, x3, x4, x5, x6)  =  U4_ggaa(x6)
U2_gg(x1, x2, x3, x4, x5, x6)  =  U2_gg(x5, x6)
getleave_in_ggga(x1, x2, x3, x4)  =  getleave_in_ggga(x1, x2, x3)
getleave_out_ggga(x1, x2, x3, x4)  =  getleave_out_ggga(x4)
U4_ggga(x1, x2, x3, x4, x5, x6)  =  U4_ggga(x6)
U3_gg(x1, x2, x3, x4, x5)  =  U3_gg(x5)
SAMELEAVES_IN_GG(x1, x2)  =  SAMELEAVES_IN_GG(x1, x2)
U1_GG(x1, x2, x3, x4, x5)  =  U1_GG(x3, x4, x5)
U2_GG(x1, x2, x3, x4, x5, x6)  =  U2_GG(x5, x6)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof

Pi DP problem:
The TRS P consists of the following rules:

U1_GG(T1, T2, S1, S2, getleave_out_ggaa(T1, T2, L, T)) → U2_GG(T1, T2, S1, S2, T, getleave_in_ggga(S1, S2, L, S))
U2_GG(T1, T2, S1, S2, T, getleave_out_ggga(S1, S2, L, S)) → SAMELEAVES_IN_GG(T, S)
SAMELEAVES_IN_GG(tree(T1, T2), tree(S1, S2)) → U1_GG(T1, T2, S1, S2, getleave_in_ggaa(T1, T2, L, T))

The TRS R consists of the following rules:

getleave_in_ggga(leaf(A), C, A, C) → getleave_out_ggga(leaf(A), C, A, C)
getleave_in_ggga(tree(A, B), C, L, O) → U4_ggga(A, B, C, L, O, getleave_in_ggga(A, tree(B, C), L, O))
getleave_in_ggaa(leaf(A), C, A, C) → getleave_out_ggaa(leaf(A), C, A, C)
getleave_in_ggaa(tree(A, B), C, L, O) → U4_ggaa(A, B, C, L, O, getleave_in_ggaa(A, tree(B, C), L, O))
U4_ggga(A, B, C, L, O, getleave_out_ggga(A, tree(B, C), L, O)) → getleave_out_ggga(tree(A, B), C, L, O)
U4_ggaa(A, B, C, L, O, getleave_out_ggaa(A, tree(B, C), L, O)) → getleave_out_ggaa(tree(A, B), C, L, O)

The argument filtering Pi contains the following mapping:
leaf(x1)  =  leaf(x1)
tree(x1, x2)  =  tree(x1, x2)
getleave_in_ggaa(x1, x2, x3, x4)  =  getleave_in_ggaa(x1, x2)
getleave_out_ggaa(x1, x2, x3, x4)  =  getleave_out_ggaa(x3, x4)
U4_ggaa(x1, x2, x3, x4, x5, x6)  =  U4_ggaa(x6)
getleave_in_ggga(x1, x2, x3, x4)  =  getleave_in_ggga(x1, x2, x3)
getleave_out_ggga(x1, x2, x3, x4)  =  getleave_out_ggga(x4)
U4_ggga(x1, x2, x3, x4, x5, x6)  =  U4_ggga(x6)
SAMELEAVES_IN_GG(x1, x2)  =  SAMELEAVES_IN_GG(x1, x2)
U1_GG(x1, x2, x3, x4, x5)  =  U1_GG(x3, x4, x5)
U2_GG(x1, x2, x3, x4, x5, x6)  =  U2_GG(x5, x6)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ UsableRulesReductionPairsProof

Q DP problem:
The TRS P consists of the following rules:

SAMELEAVES_IN_GG(tree(T1, T2), tree(S1, S2)) → U1_GG(S1, S2, getleave_in_ggaa(T1, T2))
U1_GG(S1, S2, getleave_out_ggaa(L, T)) → U2_GG(T, getleave_in_ggga(S1, S2, L))
U2_GG(T, getleave_out_ggga(S)) → SAMELEAVES_IN_GG(T, S)

The TRS R consists of the following rules:

getleave_in_ggga(leaf(A), C, A) → getleave_out_ggga(C)
getleave_in_ggga(tree(A, B), C, L) → U4_ggga(getleave_in_ggga(A, tree(B, C), L))
getleave_in_ggaa(leaf(A), C) → getleave_out_ggaa(A, C)
getleave_in_ggaa(tree(A, B), C) → U4_ggaa(getleave_in_ggaa(A, tree(B, C)))
U4_ggga(getleave_out_ggga(O)) → getleave_out_ggga(O)
U4_ggaa(getleave_out_ggaa(L, O)) → getleave_out_ggaa(L, O)

The set Q consists of the following terms:

getleave_in_ggga(x0, x1, x2)
getleave_in_ggaa(x0, x1)
U4_ggga(x0)
U4_ggaa(x0)

We have to consider all (P,Q,R)-chains.
By using the usable rules with reduction pair processor [15] with a polynomial ordering [25], all dependency pairs and the corresponding usable rules [17] can be oriented non-strictly. All non-usable rules are removed, and those dependency pairs and usable rules that have been oriented strictly or contain non-usable symbols in their left-hand side are removed as well.

No dependency pairs are removed.

The following rules are removed from R:

getleave_in_ggga(leaf(A), C, A) → getleave_out_ggga(C)
getleave_in_ggaa(leaf(A), C) → getleave_out_ggaa(A, C)
Used ordering: POLO with Polynomial interpretation [25]:

POL(SAMELEAVES_IN_GG(x1, x2)) = 2·x1 + x2   
POL(U1_GG(x1, x2, x3)) = x1 + x2 + x3   
POL(U2_GG(x1, x2)) = 2·x1 + x2   
POL(U4_ggaa(x1)) = x1   
POL(U4_ggga(x1)) = x1   
POL(getleave_in_ggaa(x1, x2)) = 2·x1 + 2·x2   
POL(getleave_in_ggga(x1, x2, x3)) = x1 + x2 + 2·x3   
POL(getleave_out_ggaa(x1, x2)) = 2·x1 + 2·x2   
POL(getleave_out_ggga(x1)) = x1   
POL(leaf(x1)) = x1   
POL(tree(x1, x2)) = x1 + x2   



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
                      ↳ QDP
                        ↳ UsableRulesReductionPairsProof
QDP
                            ↳ RuleRemovalProof

Q DP problem:
The TRS P consists of the following rules:

SAMELEAVES_IN_GG(tree(T1, T2), tree(S1, S2)) → U1_GG(S1, S2, getleave_in_ggaa(T1, T2))
U1_GG(S1, S2, getleave_out_ggaa(L, T)) → U2_GG(T, getleave_in_ggga(S1, S2, L))
U2_GG(T, getleave_out_ggga(S)) → SAMELEAVES_IN_GG(T, S)

The TRS R consists of the following rules:

getleave_in_ggga(tree(A, B), C, L) → U4_ggga(getleave_in_ggga(A, tree(B, C), L))
U4_ggga(getleave_out_ggga(O)) → getleave_out_ggga(O)
getleave_in_ggaa(tree(A, B), C) → U4_ggaa(getleave_in_ggaa(A, tree(B, C)))
U4_ggaa(getleave_out_ggaa(L, O)) → getleave_out_ggaa(L, O)

The set Q consists of the following terms:

getleave_in_ggga(x0, x1, x2)
getleave_in_ggaa(x0, x1)
U4_ggga(x0)
U4_ggaa(x0)

We have to consider all (P,Q,R)-chains.
By using the rule removal processor [15] with the following polynomial ordering [25], at least one Dependency Pair or term rewrite system rule of this QDP problem can be strictly oriented.
Strictly oriented dependency pairs:

U1_GG(S1, S2, getleave_out_ggaa(L, T)) → U2_GG(T, getleave_in_ggga(S1, S2, L))


Used ordering: POLO with Polynomial interpretation [25]:

POL(SAMELEAVES_IN_GG(x1, x2)) = 2·x1 + 2·x2   
POL(U1_GG(x1, x2, x3)) = 2·x1 + 2·x2 + x3   
POL(U2_GG(x1, x2)) = 2·x1 + x2   
POL(U4_ggaa(x1)) = x1   
POL(U4_ggga(x1)) = x1   
POL(getleave_in_ggaa(x1, x2)) = 2·x1 + x2   
POL(getleave_in_ggga(x1, x2, x3)) = 2·x1 + 2·x2 + x3   
POL(getleave_out_ggaa(x1, x2)) = 1 + 2·x1 + 2·x2   
POL(getleave_out_ggga(x1)) = 2·x1   
POL(tree(x1, x2)) = x1 + x2   



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
                      ↳ QDP
                        ↳ UsableRulesReductionPairsProof
                          ↳ QDP
                            ↳ RuleRemovalProof
QDP
                                ↳ DependencyGraphProof

Q DP problem:
The TRS P consists of the following rules:

SAMELEAVES_IN_GG(tree(T1, T2), tree(S1, S2)) → U1_GG(S1, S2, getleave_in_ggaa(T1, T2))
U2_GG(T, getleave_out_ggga(S)) → SAMELEAVES_IN_GG(T, S)

The TRS R consists of the following rules:

getleave_in_ggga(tree(A, B), C, L) → U4_ggga(getleave_in_ggga(A, tree(B, C), L))
U4_ggga(getleave_out_ggga(O)) → getleave_out_ggga(O)
getleave_in_ggaa(tree(A, B), C) → U4_ggaa(getleave_in_ggaa(A, tree(B, C)))
U4_ggaa(getleave_out_ggaa(L, O)) → getleave_out_ggaa(L, O)

The set Q consists of the following terms:

getleave_in_ggga(x0, x1, x2)
getleave_in_ggaa(x0, x1)
U4_ggga(x0)
U4_ggaa(x0)

We have to consider all (P,Q,R)-chains.
The approximation of the Dependency Graph [15,17,22] contains 0 SCCs with 2 less nodes.